/**
 * Copyright (C)  Gadglet .
 *
 * This file is part of Gadglet
 *
 * Gadglet is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Gadglet is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with Gadglet. If not, see <http://www.gnu.org/licenses/>.
 */

package com.gadglet.gadgets.discussions.server;

import java.util.ArrayList;
import java.util.List;

import javax.jdo.annotations.Element;
import javax.jdo.annotations.Extension;
import javax.jdo.annotations.Inheritance;
import javax.jdo.annotations.Order;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

import com.gadglet.core.GadgletRequestWrapper;
import com.gadglet.data.PersonalShareableContentItem;
import com.gadglet.gadgets.discussions.server.replay.Replys;
import com.google.appengine.api.datastore.Text;




@PersistenceCapable
@Inheritance(customStrategy = "complete-table")
public class DiscussionsList extends PersonalShareableContentItem {

	 @Persistent
	 private Text discussion;
	
	 

	public String getDiscussion() {
		if (discussion!=null)
			return discussion.getValue();
		else 
			return "";
	}



	public void setDiscussion(String discussion) {
		this.discussion = new Text(discussion);
	}



	public DiscussionsList(String discussion, GadgletRequestWrapper request)
	 {
		 super(request);
		 this.discussion = new Text(discussion);
	
	 }
	
	@Persistent(mappedBy = "discussionsList")
	@Element(dependent = "true")
	@Order(extensions = @Extension(vendorName="datanucleus", key="list-ordering", value="replyOrder asc"))
	private List<Replys> replay = new ArrayList<Replys>();


	public List<Replys> getReply() {
		return replay;
	}
	 
	
	
	 
}
